package DBConnection;

import EinkauferActionListener.DBOkListener;
import Einkaufer.Einkaufer;

public class DBConnectionGUI {

	private javax.swing.JTextField jTextField_adresse;
    private javax.swing.JTextField jTextField_dbname;
    private javax.swing.JTextField jTextField_password;
    private javax.swing.JTextField jTextField_user;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JButton jButton_db_abbrechen;
    private javax.swing.JButton jButton_db_ok;
    private javax.swing.JFrame JFrameConnection;
    private Einkaufer einkaufer;
    
	
    public DBConnectionGUI(Einkaufer einkaufer){
    	
    	this.einkaufer = einkaufer;
    	
    	initComponents();
    	this.JFrameConnection.setVisible(true);
    }
	
	private void initComponents(){
		
		//Init Connection Components
		JFrameConnection = new javax.swing.JFrame();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jTextField_adresse = new javax.swing.JTextField();
        jTextField_dbname = new javax.swing.JTextField();
        jTextField_user = new javax.swing.JTextField();
        jTextField_password = new javax.swing.JTextField();
        jButton_db_ok = new javax.swing.JButton();
        jButton_db_abbrechen = new javax.swing.JButton();
		
		
		
		jLabel7.setText("Database Connection");

        jLabel8.setText("Adresse:");

        jLabel9.setText("DBName:");

        jLabel10.setText("User:");

        jLabel11.setText("Password:");

        jTextField_adresse.setText("jdbc:mysql://localhost");

        jTextField_dbname.setText("automobilag");

        jTextField_user.setText("root");
        
        jTextField_password.setText("");

        jButton_db_ok.setText("OK");
        jButton_db_ok.addActionListener(new DBOkListener(this));

        jButton_db_abbrechen.setText("Abbrechen");

        javax.swing.GroupLayout JFrameConnectionLayout = new javax.swing.GroupLayout(JFrameConnection.getContentPane());
        JFrameConnection.getContentPane().setLayout(JFrameConnectionLayout);
        JFrameConnectionLayout.setHorizontalGroup(
            JFrameConnectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JFrameConnectionLayout.createSequentialGroup()
                .addGap(29, 29, 29)
                .addGroup(JFrameConnectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel7)
                    .addGroup(JFrameConnectionLayout.createSequentialGroup()
                        .addGroup(JFrameConnectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel8)
                            .addComponent(jLabel9)
                            .addComponent(jLabel10)
                            .addComponent(jLabel11))
                        .addGap(72, 72, 72)
                        .addGroup(JFrameConnectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jTextField_password)
                            .addComponent(jTextField_user)
                            .addComponent(jTextField_dbname)
                            .addComponent(jTextField_adresse, javax.swing.GroupLayout.PREFERRED_SIZE, 181, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(68, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, JFrameConnectionLayout.createSequentialGroup()
                .addContainerGap(223, Short.MAX_VALUE)
                .addComponent(jButton_db_abbrechen)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton_db_ok, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        JFrameConnectionLayout.setVerticalGroup(
            JFrameConnectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JFrameConnectionLayout.createSequentialGroup()
                .addGap(23, 23, 23)
                .addComponent(jLabel7)
                .addGap(34, 34, 34)
                .addGroup(JFrameConnectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(jTextField_adresse, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(27, 27, 27)
                .addGroup(JFrameConnectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(JFrameConnectionLayout.createSequentialGroup()
                        .addComponent(jLabel9)
                        .addGap(32, 32, 32)
                        .addGroup(JFrameConnectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel10)
                            .addComponent(jTextField_user, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jTextField_dbname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(29, 29, 29)
                .addGroup(JFrameConnectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel11)
                    .addComponent(jTextField_password, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 33, Short.MAX_VALUE)
                .addGroup(JFrameConnectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton_db_ok)
                    .addComponent(jButton_db_abbrechen))
                .addContainerGap())
        );
        
        JFrameConnection.pack();
		
	}

	public javax.swing.JTextField getJTextField_adresse() {
		return jTextField_adresse;
	}

	public void setJTextField_adresse(javax.swing.JTextField textField_adresse) {
		jTextField_adresse = textField_adresse;
	}

	public javax.swing.JTextField getJTextField_dbname() {
		return jTextField_dbname;
	}

	public void setJTextField_dbname(javax.swing.JTextField textField_dbname) {
		jTextField_dbname = textField_dbname;
	}

	public javax.swing.JTextField getJTextField_password() {
		return jTextField_password;
	}

	public void setJTextField_password(javax.swing.JTextField textField_password) {
		jTextField_password = textField_password;
	}

	public javax.swing.JTextField getJTextField_user() {
		return jTextField_user;
	}

	public void setJTextField_user(javax.swing.JTextField textField_user) {
		jTextField_user = textField_user;
	}

	public javax.swing.JFrame getJFrameConnection() {
		return JFrameConnection;
	}

	public Einkaufer getEinkaufer() {
		return einkaufer;
	}
}
